define(['base','msgTool'], function (base,msgTool) {
    base();
    return {
        index: function () {
            $("#doSubmit").on('click',function () {
                $.ajax({
                    url: "/itemHoliday/save/action",
                    type: 'POST',
                    data:{
                        dateStr:$("#dateStr").val()
                    },
                    dataType: "JSON",
                    beforeSend: function () {
                        //触发ajax请求开始时执行
                        $("#doSubmit").text('提交中...');
                        $("#doSubmit").attr('disabled', 'disabled');
                    },
                    success: function (data) {
                        if (data.success) {
                            msgTool.success("提交成功！");
                        } else {
                            msgTool.error(data.msg);
                        }
                    },
                    error: function () {
                        msgTool.error("操作失败，请刷新当前页面后重试！");
                    },
                    complete: function () {
                        $("#doSubmit").text("提交审核");
                        $("#doSubmit").removeAttr('disabled');
                    }
                });
            })
        }
    };
});






